docs: add extraction guide for sovereign_debt_py into its own repo#5
Conversation
…tion guide Co-authored-by: zachessesjohnson <168567202+zachessesjohnson@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds repository documentation describing how to extract the sovereign_debt_py pure-Python subproject into a standalone GitHub repository, and links that guide from the main README.
Changes:
- Added
docs/extract-sovereign-debt-py.mdwith step-by-step extraction options (history-preserving and clean-copy) plus post-extraction wiring/CI notes. - Updated
README.mdToC and added a short section linking to the extraction guide.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| docs/extract-sovereign-debt-py.md | New extraction guide documenting subtree/filter-repo/copy approaches and post-extraction dependency/CI steps. |
| README.md | Adds a ToC entry and a link to the new extraction guide. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| from sovereign_debt_py.averaging import xl_weighted_average | ||
|
|
||
| @xl_func(...) | ||
| def xl_weighted_average(values, weights): | ||
| return xl_weighted_average(values, weights) |
There was a problem hiding this comment.
In the "After" example, the imported xl_weighted_average name is immediately redefined by the wrapper function, so return xl_weighted_average(...) will recursively call itself rather than delegating to sovereign_debt_py. Use an alias import (e.g., from sovereign_debt_py.averaging import xl_weighted_average as py_weighted_average) or import the module and qualify the call to avoid shadowing.
| from sovereign_debt_py.averaging import xl_weighted_average | |
| @xl_func(...) | |
| def xl_weighted_average(values, weights): | |
| return xl_weighted_average(values, weights) | |
| from sovereign_debt_py.averaging import xl_weighted_average as py_weighted_average | |
| @xl_func(...) | |
| def xl_weighted_average(values, weights): | |
| return py_weighted_average(values, weights) |
| ```bash | ||
| # git ≥ 1.7.11 ships subtree support built-in — no extra install needed | ||
| git --version |
There was a problem hiding this comment.
The prerequisite note claims git subtree is "built-in" for git ≥ 1.7.11, but git subtree is a separate contrib script and may not be present in some git installations even if the version is new enough. Consider updating this to instruct users to run git subtree --help (or git subtree), and if missing, install/enable it (or use the git filter-repo path).
| # 3. Initialise a fresh git repo and make the first commit. | ||
| git init -b main | ||
| git add . | ||
| git commit -m "Initial commit: extracted from sovereign_debt_xl" | ||
|
|
||
| # 4. Push to the new repository. | ||
| git remote add origin https://github.com/zachessesjohnson/sovereign_debt_py.git | ||
| git branch -M main | ||
| git push -u origin main |
There was a problem hiding this comment.
git init -b main requires relatively recent Git (2.28+). Since the guide earlier implies older git versions may be fine, this step can fail on older environments. Using plain git init and relying on the existing git branch -M main step avoids the version dependency (and also removes the redundancy of setting main twice).
sovereign_debt_pyis a self-contained pure-Python sub-project inside this repo (sovereign_debt_py/with its ownpyproject.toml) that mirrorssovereign_debt_xl's analytic functions without PyXLL. This PR adds documentation on how to move it into a standalone GitHub repository.Changes
docs/extract-sovereign-debt-py.md— full extraction guide covering:sovereign_debt_py/sovereign_debt_py/)git subtree split(built-in) orgit filter-repo(pip-installable, faster)git init -b main+ push)pyproject.toml: git URL, PyPI, or submodulesovereign_debt_xldelegate tosovereign_debt_pyrather than re-implementing logic.github/workflows/pytest.ymlfor the new repo; notes on what (if anything) changes insovereign_debt_xl's CIREADME.md— adds ToC entry and a short section at the bottom linking to the guideKey design note
The two packages currently share no import relationship —
sovereign_debt_xldoes not import fromsovereign_debt_py. The guide covers the optional consolidation step for teams that want to eliminate the duplication after extraction.Original prompt
Create a pull request that documents and/or implements the extraction of the
sovereign_debt_pypackage/module from this repository into its own standalone GitHub repository.Requirements:
sovereign_debt_pycurrently lives inzachessesjohnson/sovereign_debt_xl(folder path, whether it’s a package, submodule, or just a set of files).README.mdor a newdocs/page) describing how to movesovereign_debt_pyto its own repo.pip install git+https, PyPI later, or submodule)Repository:
zachessesjohnson/sovereign_debt_xlBase branch:
mainThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: Let's do option 2
zachessesjohnson/sovereign_debt_xl
Assistant: I’m paused waiting for you to accept/deny the pending repository update request in the dialog—once you respond, I can continue and set up the GitHub Actions pytest workflow.
User: @copilot Accepted Confirmation: Are you sure?
Assistant: I can’t directly write the workflow file into
zachessesjohnson/sovereign_debt_xlfrom here (permission is blocked for the integration), but you can add it in under a minute in the GitHub web UI.Create this file in your repo:
.github/workflows/pytest.ymlPaste this content:
How to add it on GitHub.com
.github/workflows/pytest.ymlmain(or to your branch and open a PR)Confirm it ran
After committing:
If you tell me what your default branch is (
mainvs something else) and whether you’re using arequirements.txt, I can adjust the workflow accordingly.User: How do I change the settings so you can access it? This would make everything a lot easier
Assistant: You generally can’t “flip a repo setting” to make this Copilot chat integration write to your repo. The
403 Resource not accessible by integrationerror usually means the GitHub App/token backing this session doesn’t have write permission to repository contents, or it’s not allowed to access that repo due to org/app policy. That’s controlled by the app installation/permissions, not a normal repo checkbox.That said, here are the realistic ways to make it work—depending on what you’re using.
Option A: Use a Pull Request tool flow (best when supported)
If your environment supports it, I can open a PR via an agent tool—but only if you explicitly ask “open a PR” and I have repo access. If it still fails, it’s the same underlying permission issue.
Option B: Install/authorize the correct GitHub App (what usually fixes it)
You (or an org admin) would need to:
sovereign_debt_xlIf you’re in an organization, there may also be:
Option C: Use a PAT locally (most reliable)
If you’re willing to run one command locally, you can give yourself a workflow where I generate patches and you apply them, or you push via git.
reposcope (private) orpublic_repo(public)git pushfrom your machineI can guide you through the exact commands, but I...
This pull request was created from Copilot chat.
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.